home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu634.dms
/
pu634.adf
/
GENIES
/
Star.pdrx
< prev
next >
Wrap
Text File
|
1994-09-06
|
3KB
|
120 lines
/*
Copyright 1992 StarTeck. All rights reserved.
This Genie will create a star !!!
starburst !!!
triangle !!!
square !!!
inside-out star !!!
pentagon !!!
octagon !!!
etc etc !!!
Just answer the prompts.
*/
/* Trace ?results */
call pdm_AutoUpdate(0)
cr = '0a'x
numeric digits 5
msg = PDSetup.rexx(2,0) /* set-up librarys */
units = getclip(pds_units)
if msg ~= 1 then exit_msg(msg)
pi2 = 6.28318
call pdm_unselectobj()
/* Get input values */
ODdefault = 1.000
IDdefault = 0.382
NPdefault = 5
OD = getclip(OutsideDiameter)
ID = getclip(InsideDiameter)
NP = getclip(NumberPoints)
if ~(OD = ODdefault & ID = IDdefault & NP = NPdefault) then do
if ~(OD = '' | ID = '' | NP = '') then do
DefLast = pdm_inform(3,'Input selection method...','DEFAULTS','Cancel','LAST USED')
if DefLast = 1 then exit_msg()
if DefLast = 0 then do
OD = ODdefault
ID = IDdefault
NP = NPdefault
end
end
end
IF OD = '' then OD = ODdefault
IF ID = '' then ID = IDdefault
IF NP = '' then NP = NPdefault
if units > 2 then OD = pdm_ConvertUnits(1,units,OD)
if units > 2 then ID = pdm_ConvertUnits(1,units,ID)
prefsprompt = 'Outside Diameter:'OD ||cr|| ' Inside Diameter:'ID ||cr|| 'Number of Points:'NP
userprefs = pdm_getform('Input values...',7,prefsprompt)
if userprefs = '' then exit_msg()
parse var userprefs OD (cr) ID (cr) NP
if (OD = '') | (ID = '') | (NP = '') then exit_msg('Blank entry, re-run the Star Genie')
if ~(datatype(NP,n) & datatype(OD,n) & datatype(ID,n)) then exit_msg(Invalid entry...)
if NP < 2 then exit_msg('Number of points must be greater than 1...')
if units > 2 then OD = pdm_ConvertUnits(units,1,OD)
if units > 2 then ID = pdm_ConvertUnits(units,1,ID)
call setclip(OutsideDiameter,OD)
call setclip(InsideDiameter,ID)
call setclip(NumberPoints,NP)
IR = ID/2
OR = OD/2
/* Get center point */
if OR > IR then
Largest = OR
else
Largest = IR
center = PDM_clickellipse("Where do you want the center of the star?",Largest,Largest)
if center = '' then exit_msg()
xcenter = word(center,1)
ycenter = word(center,2)
StartAngle = (pi2 / 4)
increment = ((pi2 / NP)/2)
incrementangle = StartAngle
call pdm_InitPlot(xcenter,ycenter,1,1,0) /* initiate incremental start-point */
call pdm_ShowStatus("Working...")
do i = 1 to NP
x = cos(IncrementAngle) * IR
y = sin(IncrementAngle) * IR
call pdm_plotline(x" "y)
incrementangle = incrementangle + increment
x = cos(IncrementAngle) * OR
y = sin(IncrementAngle) * OR
call pdm_plotline(x" "y)
incrementangle = incrementangle + increment
end /* do loop */
call pdm_ClosePlot()
exit_msg()
exit_msg:
do
parse arg message
if message ~= '' then
call pdm_Inform(1, message,)
call pdm_ClearStatus()
call pdm_SetUnits(units)
call pdm_AutoUpdate(1)
exit
end